/**
 * Copyright (C), 2015-2018, XXX有限公司
 * FileName: Swagger2
 * Author:   zmy
 * Date:     2018/3/2 下午5:06
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.jmz.qyyl;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.*;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * 〈一句话功能简述〉<br>
 * 〈〉
 *
 * @author zmy
 * @create 2018/3/2
 * @since 1.0.0
 */
@Configuration
@EnableSwagger2
public class Swagger2 {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.jmz.qyyl.controller"))
                .paths(PathSelectors.any())
                .build();
    }


    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("springboot+druid+mybatis+swagger2 RESTful APIs")
                .description("api根地址：http://localhost:8080/")
                .contact(new Contact("ZMY","http://localhost:8080/","17602951546@163.com"))
                .version("1.0")
                .build();
    }

}
